package entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * Billet entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "billet", schema = "public")
public class Billet implements java.io.Serializable {

	// Fields

	private Integer id;
	
	private Vente vente;
	private Typeb typeb;
	private boolean utilise;
	private boolean vendu;
	private Integer bnrAcces;
	private String numero;
        private boolean reserve;
	private Set<Kit> kits = new HashSet<Kit>(0);

	// Constructors

	/** default constructor */
	public Billet() {
	}

	/** full constructor */
	public Billet(Kit kit, Vente vente, Typeb typeb, boolean utilise,
			boolean vendu, Integer bnrAcces, String numero, Set<Kit> kits) {
		 
		this.vente = vente;
		this.typeb = typeb;
		this.utilise = utilise;
		this.vendu = vendu;
		this.bnrAcces = bnrAcces;
		this.numero = numero;
		this.kits = kits;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	 

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_vente")
	public Vente getVente() {
		return this.vente;
	}

	public void setVente(Vente vente) {
		this.vente = vente;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_tb")
	public Typeb getTypeb() {
		return this.typeb;
	}

	public void setTypeb(Typeb typeb) {
		this.typeb = typeb;
	}

	@Column(name = "utilise")
	public boolean getUtilise() {
		return this.utilise;
	}

	public void setUtilise(boolean utilise) {
		this.utilise = utilise;
	}

	@Column(name = "vendu")
	public boolean getVendu() {
		return this.vendu;
	}

	public void setVendu(boolean vendu) {
		this.vendu = vendu;
	}

	@Column(name = "bnr_acces")
	public Integer getBnrAcces() {
		return this.bnrAcces;
	}

	public void setBnrAcces(Integer bnrAcces) {
		this.bnrAcces = bnrAcces;
	}

	@Column(name = "numero")
	public String getNumero() {
		return this.numero;
	}

	public void setNumero(String numero) {
		this.numero = numero;
	}
@Column(name = "reserve")
	
    public boolean isReserve() {
        return reserve;
    }

    public void setReserve(boolean reserve) {
        this.reserve = reserve;
    }
        
        

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "billet")
	public Set<Kit> getKits() {
		return this.kits;
	}

	public void setKits(Set<Kit> kits) {
		this.kits = kits;
	}

}